package com.ashes.belife.common.exception;


import com.ashes.belife.common.utils.ResultCodeEnum;
import lombok.Data;

/**
 * @author chengxuhui
 */
@Data
public class AshesException extends RuntimeException{

    //状态码
    private Integer code;
    //消息：命名为msg，不覆盖重要的系统错误message
    private String msg;


    public AshesException(ResultCodeEnum resultCodeEnum, Throwable cause) {
        super(cause);
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
    }

    public AshesException(ResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
    }

    public AshesException(Integer code, String msg, Throwable cause) {
        super(cause);
        this.code = code;
        this.msg = msg;
    }

    public AshesException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public AshesException( String msg) {
        this.msg = msg;
    }

    public AshesException(Throwable cause){
        super(cause);
    }
}
